
<%@ page import="cn.myschool.service.SubjectService" %>
<%@ page import="cn.myschool.entity.Subject" %>
<%@ page import="cn.myschool.entity.Grade" %>
<%@ page import="java.util.List" %>
<%@ page import="cn.myschool.service.GradeService" %>
<%@ page import="java.util.Enumeration" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>超市账单管理系统</title>
    <link rel="stylesheet" href="css/public.css"/>
    <link rel="stylesheet" href="css/style.css"/>
    <script src="js/jquery.js"></script>
</head>
<body>


<section class="publicMian ">

    <%
        //Enumeration<String> attributeNames = session.getAttributeNames();
        String id = request.getParameter("id");
        Subject subject = SubjectService.ME.get(Long.parseLong(id));
    %>
    <div class="providerAdd">
        <form action="dosubjectUpdate.jsp" method="post">

            <div class="">
                <label for="id">id：</label>
                <input type="text" name="id" id="id" value="<%=subject.getId()%>" readonly="readonly"/>
                <span>*</span>
            </div>
            <div>
                <label for="subjectname">课程名称：</label>
                <input type="text" name="subjectname" id="subjectname" value="<%=subject.getSubjectname()%>"/>
                <span>*</span>
            </div>
            <div>
                <label for="classhour">课时：</label>
                <input type="number" name="classhour" id="classhour" value="<%=subject.getClasshour() %>"/>
                <span>*</span>

            </div>
            <div><label for="gradeid">年级：：</label>

                <select name="gradeid" id="gradeid">
                    <%
                        List<Grade> grades = GradeService.ME.findALL();
                        for (Grade grade : grades) {
                            String gname = grade.getGname();
                            long sid = grade.getId();

                    %>
                    <option value="<%=sid%>"  >
                        <%=gname%>
                    </option>
                   <%-- <option value="<%=sid%>" <%if(subject.getGradeid()==sid)out.print("selected");%> >
                        <%=gname%>
                    </option>--%>
                    <%
                        }
                    %>
                </select>

            </div>

            <div class="providerAddBtn">
                <input type="submit" value="提交"/>
                <input type="button" value="返回" onclick="history.back(-1)"/>
            </div>
        </form>
    </div>

    </div>
</section>

<script>
    $(function(){
       $("#gradeid").val('<%=subject.getGradeid()%>');
    });
</script>

</body>
</html>
